import { request } from '../request';

export function fetchRegistPumpLayout(layoutKey: string, info: string) {
  return request.post<boolean>(`/pump/registLayout`, {
    layoutKey,
    info
  });
}

export function fetchPumpLayout() {
  return request.get(`/pump/getLayout`);
}

export function fetchPumpParamList() {
  return request.get<Pump.ParamList[]>(`/pump/getParamList`);
}

export function fetchInsertOrUpdateParm(parm: Pump.ParamList) {
  return request.post<boolean>(`/pump/insertOrUpdateParm`, parm);
}

export function fetchDeleteParm(parm: Pump.ParamList) {
  return request.post<boolean>(`/pump/deleteParm`, parm);
}

export function fetchLineList() {
  return request.get<Pump.Machine[]>(`/pump/getLineList`);
}

export function fetchInsertOrUpdateLine(line: Pump.Machine) {
  return request.post<boolean>(`/pump/insertOrUpdateLine`, line);
}

export function fetchDeleteLine(line: Pump.Machine) {
  return request.post<boolean>(`/pump/deleteLine`, line);
}

export function fetchMachineList(line: string) {
  return request.get<Pump.Machine[]>(`/pump/getMachineList?line=${line}`);
}

export function fetchPumpList(machineName: string) {
  return request.get<Pump.Pump[]>(`/pump/getPumpList?machineName=${machineName}`);
}

export function fetchPumpAllList() {
  return request.get<Pump.Pump[]>(`/pump/getPumpAllList`);
}

export function fetchParamCollectItemList(pumpId: string, startTime: string, endTime: string) {
  return request.get<Pump.ParamCollectItem[]>(
    `/pump/getParamCollectItem?pumpId=${pumpId}&startTime=${startTime}&endTime=${endTime}`
  );
}
